import {ref, computed} from 'vue'
import {defineStore} from 'pinia'
import {tooltipEmits} from "element-plus";

export const useUserStore = defineStore('user', () => {
    const token = ref('')
    const userinfo = ref({})

    function setToken(t: string) {
        token.value = t
        localStorage.setItem('token', t)
    }

    function setUserInfo(t: Object) {
        userinfo.value = t
        localStorage.setItem('userinfo', JSON.stringify(t))
    }

    return {token, userinfo, setToken, setUserInfo}
})